package d03_thread_callable;

import java.util.concurrent.Callable;

/**
 *1.定义类，实现Callable接口
 */
public class MyCallableOne implements Callable<Integer> {
    /**
     *2.重写call方法
     *  a.设置线程做的事情/任务
     *  b.设置返回线程执行完毕的结果
     */
    @Override
    public Integer call() throws Exception {
        int sum = 2;
        for (int i = 4; i <= 100; i+=2) {
            sum += i;
            System.out.println("子线程1：累加偶数···"+ i);
        }
        return sum;
    }
}
